﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace Zhaoxi.TakeaWay.App.Utility.Filters
{
    /// <summary>
    /// 解决跨域的Filter扩展
    /// </summary>
    public class CorsActionFilterAttribute : Attribute, IActionFilter
    {
        public void OnActionExecuted(ActionExecutedContext context)
        {
            context.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
        }

        public void OnActionExecuting(ActionExecutingContext context)
        {
            
        }
    }
}
